var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var uglifyJsPlugin = webpack.optimize.UglifyJsPlugin;
var path = __dirname + "/app";
module.exports = {
	entry:{
		index:path+"/index/index.js",
        vip:path+"/vip/index.js",
        classfiy:path+"/classfiy/index.js",
        me:path+"/me/index.js",
        buyCar:path+"/buyCar/index.js",//购物车 
        order:path+"/buyCarOrder/index.js",//购物车的确认订单

		login:path+"/login/index.js",
        zhuce:path+"/zhuce/index.js",
        detail:path+"/details/index.js",



        city:path+"/city/index.js",
        search:path+"/search/index.js",
        sResult:path+"/sResult/index.js",
        wonderfulLife:path+"/wonderfulLife/index.js",
        food:path+"/food/index.js",
        supplies:path+"/supplies/index.js",
        householdItems:path+"/householdItems/index.js",
        service:path+"/service/index.js",
        meCollect:path+"/meCollect/index.js",
        meOrder:path+"/meOrder/index.js",
        OrderdetailOne:path+"/OrderdetailOne/index.js",
        OrderdetailTwo:path+"/OrderdetailTwo/index.js",
        OrderdetailThree:path+"/OrderdetailThree/index.js",
        meTake:path+"/meTake/index.js",
        meData:path+"/meData/index.js",
        meVip:path+"/meVip/index.js",
        meVipup:path+"/meVipup/index.js",
        meVipgo:path+"/meVipgo/index.js",
        mePay:path+"/mePay/index.js",
        mePayup:path+"/mePayup/index.js",
        mePaybill:path+"/mePaybill/index.js",
        dataName:path+"/medataName/index.js",
        dataPhome:path+"/medataPhome/index.js",
        dataPass:path+"/medataPass/index.js",
        dataPay:path+"/medataPay/index.js",
        meMore:path+"/meMore/index.js",
        meAbout:path+"/meAbout/index.js",
        meHelp:path+"/meHelp/index.js",
        meFeedback:path+"/meFeedback/index.js"
	},
	output:{
		path:"./www",
		filename:"js/[name].js"
	},
	module: {
        loaders: [{
            test: /\.vue$/,
            loader: 'vue'
        },
        {
            test: /\.js$/,
            loader: 'babel?presets=es2015',
            exclude: /node_modules/
        },
　　　　 {
　　　　　　  test: /\.(png|jpg)$/,
　　　　　　  loader: 'url-loader?limit=1000&name=images/[name].[ext]' //将小于1000的图片转为base64
　　　　 },
        { 
            test: /\.css$/, 
            loader: 'style-loader!css-loader'
        }
        ]
    },
	resolve: {
      extensions: ['', '.js', '.vue']
    },
    devServer: {
        contentBase: "www/",
        inline:true,
        port : "3000"
    },
	plugins:[ 
    new uglifyJsPlugin({//压缩文件
      compress: {
        warnings: false
      }
    }),//直接加载到全局需要require()
    new webpack.optimize.CommonsChunkPlugin({//合并公共模块到指定的js文件,抽取vue文件
        name: 'common',
        filename: 'js/common.js',
    }),
    new CleanWebpackPlugin(['www/js','www/css','www/*.html','www/images']),
    new HtmlWebpackPlugin({
        title: '生活一家',
        filename: 'index.html',
        template: './app/index/index.html',
        chunks: ['common','index']
    }),
    new HtmlWebpackPlugin({
        title: '登陆',
        filename: 'login.html',
        template: './app/login/login.html',  
        chunks: ['common','login']     
    }),
    new HtmlWebpackPlugin({
        title: '注册',
        filename: 'zhuce.html',
        template: './app/zhuce/zhuce.html',  
        chunks: ['common','zhuce']    
    }),
    new HtmlWebpackPlugin({
        title: '分类',
        filename: 'classfiy.html',
        template: './app/classfiy/classfiy.html',  
        chunks: ['common','classfiy']     
    }),
    new HtmlWebpackPlugin({
        title: '购物车',
        filename: 'buyCar.html',
        template: './app/buyCar/buyCar.html',  
        chunks: ['common','buyCar']     
    }),
    new HtmlWebpackPlugin({//购物车的确认订单
        title: '确认订单',
        filename: 'order.html',
        template: './app/buyCarOrder/order.html',  
        chunks: ['common','order']     
    }),
    new HtmlWebpackPlugin({
        title: '我的',
        filename: 'me.html',
        template: './app/me/me.html',  
        chunks: ['common','me']     
    }),
      new HtmlWebpackPlugin({
        title: '我的订单',
        filename: 'meOrder.html',
        template: './app/meOrder/meOrder.html',  
        chunks: ['common','meOrder']     
    }),
    new HtmlWebpackPlugin({
        title: '待付款',
        filename: 'OrderdetailOne.html',
        template: './app/OrderdetailOne/OrderdetailOne.html',  
        chunks: ['common','OrderdetailOne']     
    }),
         new HtmlWebpackPlugin({
        title: '待发货',
        filename: 'OrderdetailTwo.html',
        template: './app/OrderdetailTwo/OrderdetailTwo.html',  
        chunks: ['common','OrderdetailTwo']     
    }),
       new HtmlWebpackPlugin({
        title: '待收货',
        filename: 'OrderdetailThree.html',
        template: './app/OrderdetailThree/OrderdetailThree.html',  
        chunks: ['common','OrderdetailThree']     
    }),
    new HtmlWebpackPlugin({
        title: '我的收藏',
        filename: 'meCollect.html',
        template: './app/meCollect/meCollect.html',  
        chunks: ['common','meCollect']     
    }),
    new HtmlWebpackPlugin({
        title: '升级会员',
        filename: 'meVip.html',
        template: './app/meVip/meVip.html',  
        chunks: ['common','meVip']     
    }),
    new HtmlWebpackPlugin({
        title: '会员充值',
        filename: 'meVipup.html',
        template: './app/meVipup/meVipup.html',  
        chunks: ['common','meVipup']     
    }),
    new HtmlWebpackPlugin({
        title: '充值成功',
        filename: 'meVipgo.html',
        template: './app/meVipgo/meVipgo.html',  
        chunks: ['common','meVipgo']     
    }),
    new HtmlWebpackPlugin({
        title: '我的钱包',
        filename: 'mePay.html',
        template: './app/mePay/mePay.html',  
        chunks: ['common','mePay']     
    }),
    new HtmlWebpackPlugin({
        title: '充值',
        filename: 'mePayup.html',
        template: './app/mePayup/mePayup.html',  
        chunks: ['common','mePayup']     
    }),
    new HtmlWebpackPlugin({
        title: '账单',
        filename: 'mePaybill.html',
        template: './app/mePaybill/mePaybill.html',  
        chunks: ['common','mePaybill']     
    }),
       new HtmlWebpackPlugin({
        title: '收货地址',
        filename: 'meTake.html',
        template: './app/meTake/meTake.html',  
        chunks: ['common','meTake']     
    }),
    new HtmlWebpackPlugin({
        title: '我的设置',
        filename: 'meData.html',
        template: './app/meData/meData.html',  
        chunks: ['common','meData']     
    }),
     new HtmlWebpackPlugin({
        title: '姓名',
        filename: 'dataName.html',
        template: './app/medataName/dataName.html',  
        chunks: ['common','dataName']     
    }),
       new HtmlWebpackPlugin({
        title: '联系方式',
        filename: 'dataPhome.html',
        template: './app/medataPhome/dataPhome.html',  
        chunks: ['common','dataPhome']     
    }),
         new HtmlWebpackPlugin({
        title: '修改登陆密码',
        filename: 'dataPass.html',
        template: './app/medataPass/dataPass.html',  
        chunks: ['common','dataPass']     
    }),
     new HtmlWebpackPlugin({
        title: '修改钱包密码',
        filename: 'dataPay.html',
        template: './app/medataPay/dataPay.html',  
        chunks: ['common','dataPay']     
    }),
    new HtmlWebpackPlugin({
        title: '更多',
        filename: 'meMore.html',
        template: './app/meMore/meMore.html',  
        chunks: ['common','meMore']     
    }),
    new HtmlWebpackPlugin({
        title: '帮助中心',
        filename: 'meHelp.html',
        template: './app/meHelp/meHelp.html',  
        chunks: ['common','meHelp']     
    }),
    new HtmlWebpackPlugin({
        title: '意见反馈',
        filename: 'meFeedback.html',
        template: './app/meFeedback/meFeedback.html',  
        chunks: ['common','meFeedback']     
    }),
     new HtmlWebpackPlugin({
        title: '关于我们',
        filename: 'meAbout.html',
        template: './app/meAbout/meAbout.html',  
        chunks: ['common','meAbout']     
    }),
    new HtmlWebpackPlugin({
        title: '会员杂锦',
        filename: 'vip.html',
        template: './app/vip/vip.html',  
        chunks: ['common','vip']     
    }),
    new HtmlWebpackPlugin({
        title: '选择城市',
        filename: 'city.html',
        template: './app/city/city.html',  
        chunks: ['common','city']     
    }),
    new HtmlWebpackPlugin({
        title: '搜索',
        filename: 'search.html',
        template: './app/search/search.html',  
        chunks: ['common','search']     
    }),
    new HtmlWebpackPlugin({
        title: '搜索结果',
        filename: 'sResult.html',
        template: './app/sResult/sResult.html',  
        chunks: ['common','sResult']
    }),
    new HtmlWebpackPlugin({
        title: '商家信息',
        filename: 'wonderfulLife.html',
        template: './app/wonderfulLife/wonderfulLife.html',  
        chunks: ['common','wonderfulLife']
    }),
    new HtmlWebpackPlugin({
        title: '生活食品',
        filename: 'food.html',
        template: './app/food/food.html',  
        chunks: ['common','food']
    }), 
    new HtmlWebpackPlugin({
        title: '生活用品',
        filename: 'supplies.html',
        template: './app/supplies/supplies.html',  
        chunks: ['common','supplies']
    }), 
    new HtmlWebpackPlugin({
        title: '生活家居',
        filename: 'householdItems.html',
        template: './app/householdItems/householdItems.html',  
        chunks: ['common','householdItems']
    }),
    new HtmlWebpackPlugin({
        title: '一键客服',
        filename: 'service.html',
        template: './app/service/service.html',  
        chunks: ['common','service']
    }),
    new HtmlWebpackPlugin({
        title: '分类详情',
        filename: 'detail.html',
        template: './app/details/detail.html',  
        chunks: ['common','detail']
    }),
    new webpack.ProvidePlugin({
        $: path+'/commons/jquery-3.0.0.min.js',
    })//直接加载到全局不需要require()
	]
}
// sudo cnpm install webpack style-loader css-loader vue vue-loader
// html-webpack-plugin
// babel-loader babel-core babel-preset-es2015
// vue-template-compiler

